GridCtl = Ext.extend(CmpControler, {

			getCmItems : function() {

				var items = [this.getCmItem('客户名称', 'taskName', true),
						this.getCmItem('二级单位', 'uploadUsername', true),
						this.getCmItem('项目名称', 'createTime', true),
						this.getCmItem('协议单号', 'taskStatus', true),
						this.getCmItem('订单号', 'file', false),
						this.getCmItem('接单部门', 'file', false),
						this.getCmItem('签单部门', 'programClass', true),
						this.getCmItem('销售人员', 'programColumn', true),
						this.getCmItem('接单时间', 'taskId', true),
						this.getCmItem('订单类型', 'programId', false),
						this.getCmItem('订单状态', 'keyFramePath', false),
						this.getCmItem('订单去向', 'auditMemo', false)]

				return items;
			},
			bulidComponent : function() {

				var config = this.getCommonConfig();

				this.configRecordTemplet();

				config = this.configStore(config);

				config = this.configSm(config);

				config = this.configCm(config);

				config = this.configBbar(config);

				config = this.configButtons(config);

				config = this.configOtherPara(config);

				var item = new Ext.grid.GridPanel(config);

				return item;
			},
			afterBulidComponent : function() {
			},
			rowdblclick : function() {

			},
			getCommonConfig : function() {

				var config = {
					title : '查询结果',
					name : "dvd节目单"
				};

				return config;

			},
			configButtons : function(config) {

				return config;
			},
			configStore : function(config) {

				var recordTemplet = this.recordTemplet;

				var reader = new Ext.data.JsonReader({
							totalProperty : 'totalSize',
							root : 'items'
						}, recordTemplet);

				var proxy = this.getProxy();

				var store = new Ext.data.Store({
							proxy : proxy,
							reader : reader
						});

				this.store = store;
				config.store = store;

				return config;
			},
			getProxy : function() {

				var url = this.getStoreUrl();

				var conn = new Ext.data.Connection({
							url : url,
							timeout : 60000, // 自定义超时时间，这里是60秒 (默认30s)
							autoAbort : false,
							disableCaching : true,
							method : "POST"
						});

				var proxy = new Ext.data.HttpProxy(conn);

				proxy.getConnection().on("requestcomplete",
						function(sender, response, options) {

							var responseArray = Ext.util.JSON
									.decode(response.responseText);
							var appStatus = responseArray.appStatus;
							if (appStatus) {
								if (appStatus == '0') {
									var s = cf.getC('s');
									var url = s.getUrl({
												resource : 'user/login.jsp'
											});
									self.location = url;
								} else if (appStatus == 'error') {
									alert("error");
								}
							}
						});

				proxy.getConnection().on("requestexception",
						function(sender, response, options) {
							alert('后台异常！');
						});

				return proxy;
			},
			getStoreUrl : function() {

			},
			configCm : function(config) {

				// var fm = Ext.form;
				var xg = Ext.grid;

				var items = this.getCmItems();
				var opt = [];

				this.configCmsSm(opt);

				for (var i = 0; i < items.length; i++) {

					var item = items[i];
					var isCm = item.isCm;

					if (isCm) {
						var cmItem = {
							header : items[i].name,
							sortable : false,
							dataIndex : items[i].attId
						}
						opt.push(cmItem);
					}

				}

				var cm = new xg.ColumnModel(opt);

				config.autoExpandColumn = opt.length - 1;

				config.cm = cm;
				return config;
			},
			configOtherPara : function(config) {

				// config.clicksToEdit = 2;
				// config.listeners = {
				// 'render' : function() {
				// sm.selectFirstRow();
				// }
				// };

				return config;
			},
			configRecordTemplet : function() {

				var items = this.getCmItems();

				var config = [];
				for (var i = 0; i < items.length; i++) {

					var attribute = items[i];
					var cmItem = {
						name : attribute.attId
					}
					config.push(cmItem);
				}

				var recordTemplet = Ext.data.Record.create(config);
				this.recordTemplet = recordTemplet;

			},
			load : function() {

				var store = this.store;
				store.load({
							params : {
								start : 0,
								limit : 30
							}
						});

			},
			reload : function() {

				var store = this.store;
				store.reload();

			},
			configBbar : function(config) {

				var store = this.store;

				var barConfig = {
					pageSize : 30,
					store : store,
					displayInfo : true,
					autoWidth : true,
					emptyMsg : "无记录"
				};
				barConfig = this.configBbarItems(barConfig);

				var bar = new Ext.PagingToolbar(barConfig);

				config.bbar = bar;

				return config;

			},
			configBbarItems : function(config) {

				return config;

			},
			getSelectedRecord : function() {
				var sm = this.cmp.getSelectionModel();
				return sm.getSelected();
			},
			getAllRecord : function() {
				var store = this.store;

				var count = store.getCount();

				var recordls = [];

				for (var i = 0; i < count; i++) {
					var record = store.getAt(i);
					recordls.push(record.data);
				}

				return recordls;
			},
			getSelectList : function() {
				var sm = this.cmp.getSelectionModel();
				return sm.getSelections();
			},
			getCmItem : function(name, attId, isCm) {

				return {
					name : name,
					attId : attId,
					isCm : isCm
				}

			},
			getRecord : function(index) {
				var store = this.store;
				return store.getAt(index);
			},
			getSelectIdList : function(recordList) {
				var idList = [];
				for (var i = 0; i < recordList.length; i++) {
					idList.push(recordList[i].get('id'));
				}
				return idList;
			},
			configSm : function(config) {

				var sm = new Ext.grid.RowSelectionModel();
				config.sm = sm;

				return config;
			},
			configCmsSm : function(opt) {

			},
			getItemsList : function(recordList) {
				var list = [];
				for (var i = 0; i < recordList.length; i++) {
					var item = {
						id : recordList[i].get('id')
					};

					list.push(item);
				}
				return list;
			}

		});
